package dailearn.feign.producer;

import dailearn.feign.entity.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @author daify
 * @date 2019-07-13
 */
@Service
@FeignClient("base-producer")
public interface UserService {

    /**
     * 复杂对象Feign会使用POST发请求，这个请求会发生异常
     * @param user
     * @return
     */
    @RequestMapping(value = "user",method = RequestMethod.GET)
    String getUserInfo(User user);


    @RequestMapping(value = "getNumber",method = RequestMethod.GET)
    String getNumber(Integer number);


    @RequestMapping(value = "getStr",method = RequestMethod.GET)
    String getStr(String str);

    @GetMapping(value = "getStrV2")
    String getStrV2(String str);

    @GetMapping(value = "getNone")
    String getNone();

    @RequestMapping(value = "/simple/{id}",method = RequestMethod.GET)
    String getId(@PathVariable(required = false,value = "id") Long id);

    @GetMapping(value = "/simple/{id}")
    String getIdV2(@PathVariable(required = false,value = "id") Long id);
}
